package com.dynabook.ebs.mapstruct.pcm;

import com.dynabook.ebs.model.entity.DbhItemMstV;
import com.dynabook.ebs.model.entity.PcmStockTransferDesignIf;
import com.dynabook.ebs.model.vo.PcmStockTransferDesignIfVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper
public interface PcmMapper {
    PcmMapper INSTANCE = Mappers.getMapper(PcmMapper.class);


    @Mapping(source = "pcmStockTransferDesignIf.sequenceId", target = "sequenceId")
    @Mapping(source = "pcmStockTransferDesignIf.documentNo", target = "documentNo")
    @Mapping(source = "pcmStockTransferDesignIf.itemCode", target = "itemCode")
    @Mapping(source = "pcmStockTransferDesignIf.quantity", target = "quantity")
    @Mapping(source = "pcmStockTransferDesignIf.fromSubinventoryCode", target = "fromSubinventoryCode")
    @Mapping(source = "pcmStockTransferDesignIf.toSubinventoryCode", target = "toSubinventoryCode")
    @Mapping(source = "pcmStockTransferDesignIf.unitPrice", target = "unitPrice")
    @Mapping(source = "pcmStockTransferDesignIf.amount", target = "amount")
    @Mapping(source = "pcmStockTransferDesignIf.oaRequestId", target = "oaRequestId")
    @Mapping(source = "pcmStockTransferDesignIf.processFlag", target = "processFlag")
    @Mapping(source = "pcmStockTransferDesignIf.createdBy", target = "createdBy")
    @Mapping(source = "pcmStockTransferDesignIf.creationDate", target = "creationDate")
    @Mapping(source = "pcmStockTransferDesignIf.lastUpdatedBy", target = "lastUpdatedBy")
    @Mapping(source = "pcmStockTransferDesignIf.lastUpdateDate", target = "lastUpdateDate")
    @Mapping(source = "dbhItemMstV.pn", target = "pn")
    @Mapping(source = "dbhItemMstV.pnversion", target = "pnversion")
    @Mapping(source = "dbhItemMstV.goodstype", target = "goodstype")
    @Mapping(source = "dbhItemMstV.description", target = "description")
    @Mapping(source = "dbhItemMstV.spec", target = "spec")
    @Mapping(source = "dbhItemMstV.purchaseunit", target = "purchaseunit")
    @Mapping(source = "dbhItemMstV.unit", target = "unit")
    @Mapping(source = "dbhItemMstV.unitdesc", target = "unitdesc")
    @Mapping(source = "dbhItemMstV.createddate", target = "createddate")
    @Mapping(source = "dbhItemMstV.unitwt", target = "unitwt")
    // sn 字段VO有，源对象没有，需自定义处理，如有需要可加@Mapping(target = "sn", ignore = true)
    @Mapping(target = "sn", ignore = true)
    PcmStockTransferDesignIfVO PcmToPcmVO(PcmStockTransferDesignIf pcmStockTransferDesignIf, DbhItemMstV dbhItemMstV);
}